<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%-- 
    Document   : manageNews
    Created on : Jul 17, 2013, 10:37:24 PM
    Author     : Thanh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="css/user.css">
    </head>
    <body>

        <div class="container">
            <jsp:include page="managerHeader.jsp" />
            <div class="left">
                <h2>Danh mục</h2>
                <jsp:include page="managerMenu.jsp" />
            </div>
            <div class="content">
                <h2>Quản lý tin tức</h2>
                <div>
                    <c:choose>
                        <c:when test="${empty requestScope.news}">
                            <h2>Not found!</h2>
                        </c:when>
                        <c:otherwise>
                            <table border="1">
                                <!-- column headers -->
                                <tr>
                                    <th>User</th>
                                    <th>Title</th>
                                    <th>Content</th>
                                    <th>Created Time</th>
                                    <th></th>
                                </tr>
                                <!-- column data -->
                                <c:forEach var="new" items="${requestScope.news}">
                                    <tr>
                                        <td>${new.fullName}&nbsp;(${new.username})</td>
                                        <td>${new.title}</td>
                                        <td>${new.content}</td>
                                        <td>${new.createdTime}</td>
                                        <td><a href="GetNewServlet?id=${new.newID}">Details</a> | <a href="DeleteNewServlet?id=${new.newID}">Delete</a></td>
                                    </tr>
                                </c:forEach>
                            </table>
                        </c:otherwise>
                    </c:choose>
                </div>
            </div>
            <jsp:include page="managerFooter.jsp" />
        </div>

    </body>
</html>
